package www.dashu.com.domain;

import www.dashu.com.domain.base.BaseVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Formula;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name="c_brand")
public class CBrand extends BaseVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("")
    @Id
    private Long id;

    @ApiModelProperty("名称")
    @Column(name = "name")
    private String name;

    @ApiModelProperty("排序")
    @Column(name = "order_num")
    private Long orderNum;

    @ApiModelProperty("是否为品牌制造商：0->不是；1->是")
    @Column(name = "factory_status")
    private Integer factoryStatus;

    @ApiModelProperty("产品数量")
    @Column(name = "product_count")
    private Integer productCount;

    @ApiModelProperty("产品评论数量")
    @Column(name = "product_comment_count")
    private Integer productCommentCount;

    @ApiModelProperty("品牌logo")
    @Column(name = "logo")
    private String logo;

    @ApiModelProperty("专区大图")
    @Column(name = "big_pic")
    private String bigPic;

    @ApiModelProperty("品牌故事")
    @Column(name = "brand_story")
    private String brandStory;

    @ApiModelProperty("删除状态：0->未删除；1->已删除")
    @Column(name = "delete_status")
    private Integer deleteStatus;

    @ApiModelProperty("所属商户")
    @Formula("(select s.name from sys_company s where s.id = company )")
    private String companyName;

    @Column(name = "company")
    private Long company;

    @ApiModelProperty("所属应用")
    @Formula("(select s.name from sys_app s where s.id = app_id )")
    private String appName;

    @Column(name = "app_id")
    private Long appId;

    @ApiModelProperty("创建时间")
    @Column(name = "create_time")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @Column(name = "update_time")
    private Date updateTime;


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", orderNum=").append(orderNum);
        sb.append(", factoryStatus=").append(factoryStatus);
        sb.append(", productCount=").append(productCount);
        sb.append(", productCommentCount=").append(productCommentCount);
        sb.append(", logo=").append(logo);
        sb.append(", bigPic=").append(bigPic);
        sb.append(", brandStory=").append(brandStory);
        sb.append(", deleteStatus=").append(deleteStatus);
        sb.append(", company=").append(company);
        sb.append(", appId=").append(appId);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }

}